package com.comac.tasks.manager.app.service;

import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.comac.tasks.manager.app.api.TasksManagerService;
import com.comac.tasks.manager.app.command.*;
import com.comac.tasks.manager.app.command.query.TasksManagerDetailsQryExe;
import com.comac.tasks.manager.app.command.query.TasksManagerListQryCreatorExe;
import com.comac.tasks.manager.app.command.query.TasksManagerListQryExe;
import com.comac.tasks.manager.app.dto.*;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;


/**
 * @author wfb
 */
@Service
@AllArgsConstructor
public class TasksManagerServiceImpl implements TasksManagerService {

    private TasksManagerUpExe tasksManagerUpExe;
    private TasksManagerInsertExe tasksManagerInsertExe;
    private TasksManagerUpdateExe tasksManagerUpdateExe;
    private TasksManagerDetailsQryExe tasksManagerDetailsQryExe;
    private TasksManagerListQryExe tasksManagerListQryExe;
    private TasksManagerDelExe tasksManagerDelExe;
    private TasksManagerBatchInsertExe tasksManagerBatchInsertExe;
    private TasksManagerListQryCreatorExe tasksManagerListQryCreatorExe;

    @Override
    public Response insertTasks(TasksManagerDTO tasksManagerDTO) {
        return tasksManagerInsertExe.execute(tasksManagerDTO);
    }

    @Override
    public Response batchInsertTasks(TasksManagerBatchInsertDTO batchInsertDTO) {
        return tasksManagerBatchInsertExe.execute(batchInsertDTO);
    }

    @Override
    public Response updateTasks(TasksManagerUpOperatorDTO upOperatorDTO) {
        return tasksManagerUpdateExe.execute(upOperatorDTO);
    }

    @Override
    public Response updateTasksECTime(TasksManagerUpECTimeDTO dto) {
        return tasksManagerUpdateExe.executeTimeUpdate(dto);
    }

    @Override
    public SingleResponse<TasksManagerVO> listTasksDetails(TasksManagerDetailsQry detailsQry) {
        return tasksManagerDetailsQryExe.execute(detailsQry);
    }

    @Override
    public PageResponse<TasksManagerVO> listTasks(TasksManagerQry tasksManagerQry) {
        return tasksManagerListQryExe.execute(tasksManagerQry);
    }

    @Override
    public PageResponse<TasksManagerVO> listTasksByCreator(TasksManagerQry tasksManagerQry) {
        return tasksManagerListQryCreatorExe.execute(tasksManagerQry);
    }

    @Override
    public Response updateStatus(TasksManagerUpDTO tasksManagerUpDTO) {
        return tasksManagerUpExe.execute(tasksManagerUpDTO);
    }

    @Override
    public Response delete(TasksManagerDelDTO tasksManagerDelDTO) {
        return tasksManagerDelExe.execute(tasksManagerDelDTO);
    }

    @Override
    public Response updateTaskType(TasksManagerUpTaskTypeDTO tasksManagerUpTaskTypeDTO){
        return  tasksManagerUpdateExe.executeTaskTypeUpdate(tasksManagerUpTaskTypeDTO);
    }
}
